package org.yys.seata.service;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

@LocalTCC
public interface AccountTCCService {

    @TwoPhaseBusinessAction(name="tryDecrease",commitMethod = "commitDecrease",rollbackMethod = "cancelDecrease")
    void tryDecrease(@BusinessActionContextParameter("userId") Long userId,
                     @BusinessActionContextParameter("money") Integer money);

    boolean commitDecrease(BusinessActionContext context);

    boolean cancelDecrease(BusinessActionContext context);
}
